import request from '@/utils/request';
import { stringify } from 'qs';
/**
 *获取面谈准备信息
 * @param {*} params
 */
export function getInterviewPrepare(arrangeId) {
    return request(`/api/regular/v1/probation/interviews/prepare/${arrangeId}/interview_prepare`, {
        method: 'GET'
    });
}

/**
 * 获取面谈过程信息
 */
export async function getInterviewProcedure(arrangeId) {
    return request(`/api/regular/v1/probation/interviews/procedure/${arrangeId}/interview_procedure`, {
        method: 'GET'
    });
}

/**
 * 获取面谈当前面谈录音状态
 */
export async function getInterviewAudioRecordState(data) {
    return request(
        `/api/regular/v1/probation/interviews/procedure/temp/interview_voice_record_state?${stringify(data)}`,
        {
            method: 'GET'
        }
    );
}

/**
 * 保存/更新面谈过程的录音操作状态
 */
export async function changeInterviewAudioRecordState(params) {
    return request('/api/regular/v1/probation/interviews/procedure/actions/temp/save_interview_voice_record_state', {
        method: 'POST',
        data: params
    });
}

/**
 * 保存面谈过程信息
 */
export async function onSaveInterviewprocedure(params) {
    return request('/api/regular/v1/probation/interviews/procedure/actions/save_interview_procedure', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取候选人人才简历信息详情
 * @param {*} params
 * 去oa排查该接口没用到
 */
// export function getTalentMessage(id) {
//     return request(`/api/oa/v1/work/informal/candidates/talent/${id}`, {
//         method: 'GET'
//     });
// }

/**
 * 保存/更新面试准备问题
 * @param {*} params
 */
export function saveQuestion(params) {
    return request('/api/regular/v1/probation/interviews/prepare/question/actions/save_question', {
        method: 'PUT',
        data: params
    });
}

/**
 * 删除面试准备问题
 * @param {*} params
 */
export async function deleteQuestion(questionId) {
    return request(`/api/regular/v1/probation/interviews/prepare/question/${questionId}/actions/delete_question`, {
        method: 'PUT'
    });
}

/**
 * 保存/更新面试过程的答复
 * @param {*} params
 */
export function saveAnswer(params) {
    return request('/api/regular/v1/probation/interviews/procedure/question/answer/actions/save', {
        method: 'PUT',
        data: params
    });
}

/**
 * 保存/更新面试过程的问题评论
 * @param {*} params
 */
export function saveComment(params) {
    return request('/api/regular/v1/probation/interviews/procedure/question/comment/actions/save', {
        method: 'PUT',
        data: params
    });
}

/**
 * 获取其他人问题信息
 */
export async function getOtherQuestions(arrangeId) {
    return request(`/api/regular/v1/probation/interviews/procedure/${arrangeId}/question/list_other`, {
        method: 'GET'
    });
}

// 重置面试过程的录音操作状态-临时接口
export async function resetInterviewRecordState(arrangeId) {
    return request('/api/regular/v1/probation/interviews/procedure/actions/temp/reset_interview_voice_record_state', {
        method: 'POST',
        data: { arrangeId, recordState: 2 }
    });
}

/**
 * 面试结论-创建群聊
 * @param {*} params
 */
export function createImGroup(params) {
    return request('/api/regular/v1/probation/interviews/actions/create_im_group', {
        method: 'POST',
        data: params
    });
}

/**
 *面试记录提交前，判断所有面试官是否全部提交面试反馈
 * @arrangeId {*} arrangeId
 */
export function getConclusionSubmitStatus(arrangeId) {
    return request(`/api/regular/v1/probation/interviews/conclusion/validate_records/${arrangeId}`, {
        method: 'GET'
    });
}
